package day10.shop;

/**
 * @author oldliu
 * @since 1.0
 */
import java.io.Serializable;
import java.util.Objects;

public class Card implements Comparable<Card>, Serializable {
    private int number;
    private String name;
    private String phone;//transient
    private double fen;
    private  String password;//不序列化

    public Card() {
    }

    public Card(int number, String name, String phone, double fen, String password) {
        this.number = number;
        this.name = name;
        this.phone = phone;
        this.fen = fen;
        this.password = password;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public double getFen() {
        return fen;
    }

    public void setFen(double fen) {
        this.fen = fen;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Card card = (Card) o;
        return number == card.number;
    }

    @Override
    public int hashCode() {
        return Objects.hash(number);
    }

    @Override
    public String toString() {
        return "Card{" +
                "number=" + number +
                ", name='" + name + '\'' +
                ", phone='" + phone + '\'' +
                ", fen=" + fen +
                ", password='" + password + '\'' +
                '}'+"";
    }

    @Override
    public int compareTo(Card o) {
            Card a=(Card)o;
            return (int)(this.fen-a.fen);

    }

}
